<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button id="btn">发送</button>
    <script src="../axios.min.js"></script>

    <script>
      document.querySelector("#btn").onclick = function () {
        axios({
          method: "post", // 请求方式
          url: "http://localhost:8080/json", // 请求地址
          data: JSON.stringify({
            capatcha: "123456",
            username: "admin",
            password: "123456",
          }),
          headers: {
            "content-type": "application/json",
          },
        }).then(function (response) {
          console.log(response.data); // 响应数据
          console.log(response.status); // 响应状态码
          console.log(response.statusText); // 响应状态信息
          console.log(response.headers); // 响应头
          console.log(response.config); // 请求配置
        });
        console.log("发送成功");
      };
    </script>
  </body>
</html>
